package main

import (
	"fmt"
	"log"
	"os"
	"os/signal"

	"smartconn.cc/liugen/audio"
	"smartconn.cc/tosone/ra_main/PFSE"
	"smartconn.cc/tosone/ra_main/bookInsert"
	"smartconn.cc/tosone/ra_main/config"
	"smartconn.cc/tosone/ra_main/coreEvent"
	_ "smartconn.cc/tosone/ra_main/init"
)

// GitHash githash
var GitHash = "No GitHash Provided."

// BuildStamp BuildStamp
var BuildStamp = "No BuildStamp Provided."

func init() {
	log.SetFlags(log.Lshortfile | log.LstdFlags)
}

func main() {
	fmt.Printf("App Build Git Commit Hash: %s\n", GitHash)
	fmt.Printf("UTC Build Time: %s\n", BuildStamp)

	bookInsert.Init()

	log.Println("RA is running...")
	audio.PlayBGM(config.BootAudio)

	coreEvent.BookStart()

	signalChanel := make(chan os.Signal, 1)
	signal.Notify(signalChanel, os.Interrupt)
	for {
		select {
		case <-signalChanel:
			PFSE.DeInit()
			return
		}
	}
}
